﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TAD;
using System.Drawing.Drawing2D;
using System.Drawing;

namespace MeuFreeCell
{
    public partial class frmMeuFreeCell : Form
    {
        private Point[] frame; 
        private ListaDinamica cartas;
        private Jogo jogo;
        private Random rnd;
        private Carta[] carta;   


        public frmMeuFreeCell()
        {
            InitializeComponent();
        }

        private void sobreMeuFreeCellToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSobre frm = new frmSobre();
            frm.ShowDialog();
        }

        private void frmMeuFreeCell_MouseMove(object sender, MouseEventArgs e)
        {
            
        }

        private void selecioneUmJogoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSelecioneJogo frm = new frmSelecioneJogo();
            frm.ShowDialog();
        }           

        private void fecharToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void pictureBox1_DragEnter(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Move;
        }

        private void pictureBox10_DragDrop(object sender, DragEventArgs e)
        {

        }

        private void frmMeuFreeCell_Load(object sender, EventArgs e)
        {
            this.jogo = new Jogo(false,ref carta);
            this.rnd =  new Random();
            this.cartas = new ListaDinamica();
            this.frame = new Point[]{ new Point(2,0), new Point(68,0), new Point(70,2), new Point(70,92), new Point(67,95), new Point(2,95), new Point(0,92), new Point(0,2)};
            Rectangle rec = new Rectangle(0, 0, 71, 96);
            GraphicsPath p = new GraphicsPath();
            p.AddRectangle(rec);

            this.Ace0.Region = new  Region(p);
            p.Dispose();
            this.Ace1.Region = Ace0.Region;
            this.Ace2.Region = Ace0.Region;
            this.Ace3.Region = Ace0.Region;

            this.Fc0.Region = Ace0.Region;
            this.Fc1.Region = Ace0.Region;
            this.Fc2.Region = Ace0.Region;
            this.Fc3.Region = Ace0.Region;

            this.SizeChanged += new System.EventHandler(this.frmMeuFreeCell_SizeChanged);




       // ' Make labels with rounded corners for the card dock points, 
        //' so the corners match the cards.
        //Frame = New Point() {New Point(2, 0), New Point(68, 0), New Point(70, 2), New Point(70, 92), _
                            // New Point(67, 95), New Point(2, 95), New Point(0, 92), New Point(0, 2)}

            
        }

        private void verdeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackgroundImage = global::MeuFreeCell.Properties.Resources.green;   
        }

        private void vermelhoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackgroundImage = global::MeuFreeCell.Properties.Resources.red;

        }

        private void copasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackgroundImage = global::MeuFreeCell.Properties.Resources.hearts;

        }

        private void naturezaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.BackgroundImage = global::MeuFreeCell.Properties.Resources.nature;

        }

        private void frmMeuFreeCell_SizeChanged(object sender, EventArgs e)
        {

        }

        private void DistribuirCartas(bool First4Col, byte col)
        {
            byte LastCard;
            if (First4Col)
                {
                    LastCard = 6;
                }
            else
                {
                    LastCard = 5;
                }
                this.Columns[col] = new List<PlayCards.Card>();
    byte VB$t_ui1$L0 = LastCard;
    for (byte b = 0; b <= VB$t_ui1$L0; b = (byte) (b + 1))
    {
        byte card = this.NextCard();
        this.Columns[col].Add(this.Cards[card]);
        this.Cards[card].Location = this.NextPoint(col, b);
        this.Cards[card].Parent = this.Island;
        this.Cards[card].BringToFront();
        this.Cards[card].OldPoint = this.Cards[card].Location;
    }
    int VB$t_i4$S0 = col;
    byte VB$t_ui1$S1 = LastCard;
    PlayCards.Card VB$t_ref$S0 = this.Columns[VB$t_i4$S0][VB$t_ui1$S1];
    this.AddCardEvents(ref VB$t_ref$S0);
    this.Columns[VB$t_i4$S0][VB$t_ui1$S1] = VB$t_ref$S0;

 
        }
    }
}
